﻿using SqlSugar;
using System.Collections.Generic;

namespace MESPro.Models
{
    /// <summary>
    /// 角色表
    /// </summary>
    [Tenant("Default")]
    public class Role : EntityBaseId
    {
        #region 属性

        /// <summary>
        /// 角色名 :可以理解为组名,部门名,一个RoleName下对应多个User和Function
        /// </summary>
        public string? RoleName { get; set; }

        /// <summary>
        /// 当前角色对应的用户集合
        /// </summary>
        [Navigate(typeof(UserRole), nameof(UserRole.RoleId), nameof(UserRole.UserId))]
        public List<User> Users { get; set; }

        /// <summary>
        /// 当前角色对应的功能页面集合
        /// </summary>
        [Navigate(typeof(RoleFunction), nameof(RoleFunction.RoleId), nameof(RoleFunction.FunctionId))]
        public List<Function> Functions { get; set; }

        #endregion 属性
        //public override bool Equals(object obj)
        //{
        //    Role other = obj as Role;
        //    return other.Id == Id;
        //    //return base.Equals(obj);
        //}
        //public override int GetHashCode()
        //{
        //    return 1111111;
        //}
    }
}
